Telegram Group & Telegram Channel
Работаем с файловыми путями

В стандартной библиотеке есть максимально удобный пакет pathlib для простой работы с файловыми путями.

Для представления пути к файлу есть класс Path, с объектами которого уже можно производить операции. Например, методы exists() и is_dir() проверяют, существует ли файл и является ли он директорией.

Но самой классной фичей является замена os.path.join() на более удобный и элегантный вариант с использованием слэшей, как показано на картинке.

Итого, пакет pathlib может стать частичной заменой os в некоторых случаях при работе с файловыми путями.

#pathlib



tg-me.com/python_academy/677
Create:
Last Update:

Работаем с файловыми путями

В стандартной библиотеке есть максимально удобный пакет pathlib для простой работы с файловыми путями.

Для представления пути к файлу есть класс Path, с объектами которого уже можно производить операции. Например, методы exists() и is_dir() проверяют, существует ли файл и является ли он директорией.

Но самой классной фичей является замена os.path.join() на более удобный и элегантный вариант с использованием слэшей, как показано на картинке.

Итого, пакет pathlib может стать частичной заменой os в некоторых случаях при работе с файловыми путями.

#pathlib

BY Python Academy




Share with your friend now:
tg-me.com/python_academy/677

View MORE
Open in Telegram


Python Academy Telegram | DID YOU KNOW?

Date: |

Telegram Gives Up On Crypto Blockchain Project

Durov said on his Telegram channel today that the two and a half year blockchain and crypto project has been put to sleep. Ironically, after leaving Russia because the government wanted his encryption keys to his social media firm, Durov’s cryptocurrency idea lost steam because of a U.S. court. “The technology we created allowed for an open, free, decentralized exchange of value and ideas. TON had the potential to revolutionize how people store and transfer funds and information,” he wrote on his channel. “Unfortunately, a U.S. court stopped TON from happening.”

Telegram announces Anonymous Admins

The cloud-based messaging platform is also adding Anonymous Group Admins feature. As per Telegram, this feature is being introduced for safer protests. As per the Telegram blog post, users can “Toggle Remain Anonymous in Admin rights to enable Batman mode. The anonymized admin will be hidden in the list of group members, and their messages in the chat will be signed with the group name, similar to channel posts.”

Python Academy from sg


Telegram Python Academy
FROM USA